:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { font-size: 1rem; line-height: 1.6; }

/* Nav */
.nav { background: var(--gray-900); }
.nav a { transition: background 0.15s; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,0.12); }

/* Cards */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  padding: 20px;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.card:focus-within { box-shadow: 0 0 0 6px rgba(79,70,229,0.4); }
.dash-row:focus { background: var(--gray-50); box-shadow: inset 4px 0 0 var(--primary); }

.stat-card {
  text-align: center;
  padding: 24px 16px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.5;
}
.badge-A { background: #fef3c7; color: #92400e; }
.badge-R { background: #d1fae5; color: #065f46; }
.badge-C { background: #ede9fe; color: #5b21b6; }
.badge-I { background: #e5e7eb; color: #6b7280; }
.badge-alert { background: #fee2e2; color: #991b1b; }
.badge-confirmed { background: #d1fae5; color: #065f46; }

/* Project card grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.project-card {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  padding: 12px 14px;
  transition: all 0.2s;
  cursor: pointer;
}
.project-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(79,70,229,0.1);
}
.project-card .header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.project-card .pid {
  font-size: 0.75rem;
  color: var(--gray-500);
  font-weight: 600;
}
.project-card .pname {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-top: 1px;
  line-height: 1.3;
}
.project-card .biz {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
}
.project-card .summary-box {
  background: var(--gray-50);
  border-radius: 6px;
  padding: 8px;
  margin-top: 8px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--gray-700);
}
.project-card .meta {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.825rem;
  color: var(--gray-500);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #4338ca; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }
.btn-ghost { background: transparent; color: var(--gray-700); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 14px; font-size: 0.875rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s;
}
.modal-content {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.2s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* RACI Matrix */
.raci-matrix {
  display: grid;
  gap: 1px;
  background: var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.raci-cell {
  background: white;
  padding: 8px 12px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.raci-cell.header {
  background: var(--gray-50);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-500);
}
.raci-cell.staff-name {
  justify-content: flex-start;
  font-weight: 600;
}

/* Timeline */
.timeline-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

/* Form */
textarea, input[type="text"], select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
textarea:focus, input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
textarea { min-height: 100px; resize: vertical; }

/* Loading */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Report grid */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 8px;
}
.report-card {
  background: white;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  padding: 10px 12px;
}
.report-card:focus-within { box-shadow: 0 0 0 6px rgba(79,70,229,0.4); }
.report-card textarea {
  min-height: 60px;
  font-size: 1rem;
  padding: 8px 10px;
}

/* Keyboard shortcut badge */
kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.85rem;
  font-family: inherit;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.06);
  color: var(--gray-700);
}

/* Shortcut bar (sticky footer) */
.shortcut-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--gray-900);
  color: #e5e7eb;
  font-size: 0.9rem;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 50;
}
.shortcut-bar kbd {
  background: var(--gray-700);
  border-color: var(--gray-500);
  color: #fff;
}
.shortcut-sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: var(--gray-700);
  margin: 0 6px;
}

/* Tailwind text-size overrides for readability */
.text-xs { font-size: 0.85rem !important; line-height: 1.4 !important; }
.text-sm { font-size: 0.95rem !important; line-height: 1.5 !important; }
.text-lg { font-size: 1.2rem !important; }

@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}
