/* ═══════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--t-std), box-shadow var(--t-std);
  backdrop-filter: blur(8px);
}

.card:hover { border-color: rgba(255,255,255,0.14); }

.card-glass {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

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

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ═══════════════════════════════════════════════
   KPI CARDS
═══════════════════════════════════════════════ */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--t-std), transform var(--t-std), box-shadow var(--t-std);
  position: relative;
  overflow: hidden;
}

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

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--kpi-color-dim, var(--accent-subtle));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
}

.kpi-delta.up   { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-delta.neutral { color: var(--text-muted); }

/* ═══════════════════════════════════════════════
   PROJECT CARDS (dashboard grid)
═══════════════════════════════════════════════ */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--t-std);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  color: inherit;
}

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

.project-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255,255,255,0.14);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.project-card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  flex: 1;
}

.project-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.project-card-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.project-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-stat-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.project-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Sparkline container */
.sparkline-wrap {
  height: 40px;
  width: 100%;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════
   BADGES & CHIPS
═══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* Status badges */
.badge-todo     { background: var(--bg-hover); color: var(--text-muted); }
.badge-progress { background: var(--blue-dim); color: var(--blue); }
.badge-done     { background: var(--green-dim); color: var(--green); }
.badge-blocked  { background: var(--red-dim); color: var(--red); }
.badge-active   { background: var(--green-dim); color: var(--green); }
.badge-archived { background: var(--bg-hover); color: var(--text-muted); }
.badge-completed { background: var(--accent-subtle); color: var(--accent); }

/* Priority badges */
.badge-high     { background: rgba(239,68,68,0.15);  color: var(--priority-high); }
.badge-standard { background: rgba(99,102,241,0.15); color: var(--priority-standard); }

/* SPI badge */
.spi-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

.spi-badge.ahead    { background: var(--green-dim);  color: var(--green); }
.spi-badge.on-track { background: var(--blue-dim);   color: var(--blue); }
.spi-badge.behind   { background: var(--yellow-dim); color: var(--yellow); }
.spi-badge.critical { background: var(--red-dim);    color: var(--red); }

/* Tag chips */
.tag {
  display: inline-flex;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════
   PROGRESS BARS
═══════════════════════════════════════════════ */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--progress-color, var(--accent)), var(--progress-color-end, var(--accent)));
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -50%;
  width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: progress-shine 2s ease infinite;
}

@keyframes progress-shine {
  0%   { left: -50%; }
  100% { left: 150%; }
}

.progress-bar-lg { height: 8px; }
.progress-bar-xl { height: 12px; }

/* Progress inline in tasks */
.task-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.task-progress-row input[type="range"] {
  flex: 1;
}

.task-progress-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  min-width: 34px;
  text-align: right;
}

/* ═══════════════════════════════════════════════
   TASK LIST
═══════════════════════════════════════════════ */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: all var(--t-fast);
  cursor: default;
}

.task-item:hover { border-color: rgba(255,255,255,0.14); background: var(--bg-hover); }
.task-item.done  { opacity: 0.6; }

.task-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.task-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  width: 18px;
  flex-shrink: 0;
  transition: transform var(--t-fast), color var(--t-fast);
}

.task-expand-btn:hover { color: var(--text-primary); }
.task-expand-btn.open { transform: rotate(90deg); }

.task-title {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.task-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.task-date-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.task-date-chip.overdue { color: var(--red); }

.task-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

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

/* Subtasks container */
.subtask-list {
  margin-top: 10px;
  padding-left: 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 1px solid var(--border);
  margin-left: 9px;
}

/* ═══════════════════════════════════════════════
   DEADLINE CARDS (dashboard)
═══════════════════════════════════════════════ */
.deadline-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: all var(--t-fast);
}

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

.deadline-countdown {
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}

.deadline-days {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.deadline-days.urgent  { color: var(--red); }
.deadline-days.soon    { color: var(--yellow); }
.deadline-days.ok      { color: var(--green); }

.deadline-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.deadline-info { flex: 1; min-width: 0; }

.deadline-task-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deadline-project-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.deadline-progress-mini {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius);
  width: fit-content;
  margin-bottom: 20px;
}

.tab-btn {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  transition: all var(--t-fast);
  font-family: inherit;
}

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

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .tab-btn.active { background: #fff; }

/* ═══════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease forwards;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease forwards;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title { font-size: 17px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
  font-size: 20px;
  line-height: 1;
}

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

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  animation: slideIn 0.3s ease forwards;
  max-width: 320px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--accent); }
.toast.warning { border-left: 3px solid var(--yellow); }

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

.toast.removing { animation: toastOut 0.3s ease forwards; }

/* ═══════════════════════════════════════════════
   CHART CONTAINERS
═══════════════════════════════════════════════ */
.chart-wrap {
  width: 100%;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}

.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

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

.legend-line {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-dashed {
  width: 20px;
  height: 0;
  border-top: 2px dashed;
  flex-shrink: 0;
}

/* Gantt container */
.gantt-container {
  overflow-x: auto;
  overflow-y: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-height: 500px;
}

/* ═══════════════════════════════════════════════
   PROJECT DETAIL HEADER
═══════════════════════════════════════════════ */
.project-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

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

.project-header-color {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.project-header-info { flex: 1; }

.project-header-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.project-header-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.project-header-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.project-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════
   COLOR PICKER
═══════════════════════════════════════════════ */
.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--t-fast);
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text-primary); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ═══════════════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  transition: all var(--t-fast);
  font-family: inherit;
}

.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent); }

/* ═══════════════════════════════════════════════
   SETTINGS PAGE
═══════════════════════════════════════════════ */
.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.settings-row:last-child { border-bottom: none; }

.settings-label h4 { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.settings-label p  { font-size: 12px; color: var(--text-muted); }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background var(--t-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--t-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Accent palette buttons */
.accent-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.accent-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--t-fast);
  outline: none;
}

.accent-btn:hover { transform: scale(1.15); }
.accent-btn.active { border-color: var(--text-primary); box-shadow: 0 0 0 4px var(--accent-glow); }

/* ═══════════════════════════════════════════════
   HISTORY PAGE
═══════════════════════════════════════════════ */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  opacity: 0.75;
  transition: all var(--t-std);
}

.history-card:hover { opacity: 1; box-shadow: var(--shadow); }

/* ═══════════════════════════════════════════════
   PAGE-SPECIFIC
═══════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 { margin: 0; }

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Divider */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* Search input */
.search-input-wrap {
  position: relative;
}

.search-input-wrap input {
  padding-left: 34px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
