:root {
  --bg-color: #0f172a; /* Tailwind Slate 900 */
  --panel-bg: rgba(30, 41, 59, 0.7); /* Slate 800 with opacity */
  --border-color: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #3b82f6; /* Blue 500 */
  --accent-hover: #2563eb;
  --node-bg: #334155;
  --node-completed: #10b981; /* Emerald 500 */
  --node-in-progress: #f59e0b; /* Amber 500 */
  --node-pending: #64748b; /* Slate 500 */
  --font-family: 'Inter', sans-serif;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, transparent 60%);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 2rem;
  overflow-x: hidden;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem 2rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.hidden {
  display: none !important;
}

header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.config-bar {
  display: flex;
  gap: 1.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.form-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input[type="date"], input[type="text"], input[type="email"], select, textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

button {
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-btn {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.primary-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.23);
}

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

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-container {
  padding: 5.5rem 2rem 4rem 2rem;
  overflow-x: auto;
  outline: none;
}

.timeline-axis {
  position: relative;
  width: 1100px;
  min-width: 1100px;
  height: 2.2rem;
  margin-bottom: 0.8rem;
}

.timeline-axis-marker {
  position: absolute;
  top: 0;
  bottom: -24rem;
  width: 1px;
  transform: translateX(-50%);
}

.timeline-axis-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  color: #e2e8f0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.timeline-axis-line {
  position: absolute;
  top: 1.35rem;
  left: 50%;
  bottom: 0;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(226, 232, 240, 0.35), rgba(226, 232, 240, 0.02));
}

.timeline-track-wrapper {
  position: relative;
  width: 1100px;
  min-width: 1100px;
  height: 250px;
  background: transparent;
  border-radius: 24px;
  margin: 1.2rem 0 2rem 0;
}

.progress-bar {
  position: absolute;
  top: 60px;
  left: 0;
  height: 18px;
  background: linear-gradient(90deg, #10b981, #3b82f6);
  border-radius: 999px;
  width: 0%; /* Dynamic */
  transition: width 0.5s ease-in-out;
}

.timeline-node {
  position: absolute;
  top: 60px;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--node-pending);
  border: 6px solid var(--panel-bg);
  cursor: pointer;
  transition: var(--transition);
  z-index: 10;
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.03);
  padding: 0;
  display: block;
}

.timeline-node.status-completed { background: var(--node-completed); }
.timeline-node.status-in_progress { background: var(--node-in-progress); }

.timeline-node:hover {
  transform: translate(-50%, -50%) scale(1.3);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.node-label {
  position: absolute;
  top: -2rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-weight: 700;
  transition: var(--transition);
}

.timeline-node:hover .node-label {
  color: var(--text-primary);
  transform: translateX(-50%) scale(1.05);
}

.node-date {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.7rem;
  color: var(--text-secondary);
  opacity: 0.7;
  transition: var(--transition);
}

.timeline-node:hover .node-date {
  opacity: 1;
  color: var(--text-primary);
}

/* Arrow for Current Date */
.current-date-arrow {
  position: absolute;
  bottom: -80px; /* Pushed further down to avoid overlapping rotated text */
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  transition: left 0.5s ease-in-out;
}

.arrow-up {
  width: 0; 
  height: 0; 
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid var(--accent);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.arrow-label {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--accent);
  padding: 4px 10px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.4);
}

.qcs-list h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.qcs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.qc-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
  max-height: 8.4rem;
}

.qc-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: var(--accent);
  transform: translateY(-2px);
  max-height: 28rem;
}

.qc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.qc-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.qc-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.status-completed { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-in_progress { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-pending { background: rgba(100, 116, 139, 0.15); color: #94a3b8; }

.qc-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.qc-card-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.qc-notes-preview {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.qc-readonly-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.qc-link {
  color: #7dd3fc;
  text-decoration: none;
  word-break: break-word;
}

.qc-link:hover {
  text-decoration: underline;
}

.qc-link.muted {
  color: var(--text-secondary);
}

.qc-notes-readonly {
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: pre-wrap;
  line-height: 1.45;
}

.qc-meta-line {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.qc-actions-row {
  margin-top: 0.6rem;
  display: flex;
  justify-content: flex-end;
}

.qc-result-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.qc-result-ok {
  color: #86efac;
  background: rgba(34, 197, 94, 0.16);
}

.qc-result-issues {
  color: #fdba74;
  background: rgba(249, 115, 22, 0.16);
}

.qc-result-rejected {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.16);
}

.qc-result-unknown {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.16);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: min(92vh, 980px);
  margin: auto;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-content h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.modal-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

textarea {
  resize: vertical;
}

@media (max-width: 768px) {
  .config-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .role-profiles-layout {
    grid-template-columns: 1fr;
  }

  .template-phase-row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "position"
      "phase-id"
      "phase-name"
      "actions";
  }

  .template-phase-actions {
    justify-content: flex-end;
  }

  #templatesModal .modal-content {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
  }

  .template-phase-editor {
    max-height: 32vh;
  }
}

/* --- NEW DASHBOARD STYLES --- */
.view-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: fadeIn 0.4s ease-in-out;
}

.view-container.hidden {
  display: none;
}

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

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-direction: row;
}

.user-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.dashboard-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.controls-left, .controls-right {
  display: flex;
  gap: 1rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.project-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.project-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.project-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.project-progress-container {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.project-progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 4px;
  overflow: hidden;
}

.project-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  transition: width 0.8s ease;
}

.project-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- PROJECT VIEW SPECIFICS --- */
.project-header-top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.project-titles {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.project-titles h2 {
  font-size: 1.6rem;
  color: var(--text-primary);
  margin: 0;
}

.roles-container h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.roles-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
}

.role-name {
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.role-user {
  color: var(--text-primary);
  font-weight: 600;
}

.timeline-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

/* Event Node (Custom Links/Notes) */
.timeline-event-node {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: #a855f7; /* Purple */
  border-radius: 4px; /* Square for events to distinguish from round QCs */
  cursor: pointer;
  z-index: 8;
  transition: var(--transition);
}

.timeline-event-node:hover {
  transform: translate(-50%, -50%) scale(1.4);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.timeline-event-node .node-label {
  color: #c084fc;
}

.timeline-lane-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 18px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-lane-caption {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(226, 232, 240, 0.7);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 0;
  pointer-events: none;
}

.timeline-lane-node {
  position: absolute;
}

.timeline-inline-label {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.92;
  pointer-events: none;
}

.timeline-node:hover .timeline-inline-label {
  max-width: none;
  white-space: nowrap;
  z-index: 20;
}

.timeline-inline-label.offset-1 {
  top: -3.2rem;
}

.timeline-inline-label.offset-2 {
  top: -4.4rem;
}

.shape-circle {
  border-radius: 50%;
}

.shape-square {
  border-radius: 4px;
}

.shape-diamond {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.shape-diamond:hover {
  transform: translate(-50%, -50%) scale(1.2);
}

.shape-triangle-up,
.shape-triangle-down {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  border-radius: 0;
}

.shape-triangle-down {
  clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

.shape-square.event-comment {
  background: #38bdf8;
}

.shape-diamond.event-comment {
  background: #f59e0b;
}

.shape-triangle-up.team-entry-node {
  background: #22c55e;
}

.shape-triangle-down.team-exit-node {
  background: #ef4444;
}

/* Form Row for Modals */
.form-row {
  display: flex;
  gap: 1rem;
}

.roles-assignment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* --- ZOOM & TIMELINE ENHANCEMENTS --- */
.timeline-container {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6.5rem 2rem 5rem 2rem;
  perspective: 1000px;
}

.timeline-track-wrapper {
  transition: transform 0.2s ease-out;
  transform-origin: left center;
}

.zoom-controls {
  display: flex;
  gap: 0.5rem;
  margin-right: 1.5rem;
  background: rgba(0,0,0,0.2);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.timeline-actions {
  margin-top: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-secondary-tracks {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  margin-top: 1.4rem;
  width: 1100px;
  min-width: 1100px;
}

.timeline-secondary-row {
  position: relative;
}

.timeline-secondary-label {
  position: absolute;
  top: -1.25rem;
  transform: translateX(-50%);
  color: var(--text-secondary);
  font-size: 0.62rem;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 4;
  background: rgba(15, 23, 42, 0.92);
  padding: 0.15rem 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.timeline-secondary-label.label-from-start {
  transform: translateX(0);
  margin-left: 0.45rem;
}

.timeline-secondary-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: visible;
}

.timeline-secondary-connector {
  position: absolute;
  top: -48px;
  width: 2px;
  height: 48px;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.15), rgba(148, 163, 184, 0.95));
  transform: translateX(-50%);
  z-index: 1;
}

.timeline-secondary-bar {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  z-index: 2;
}

.timeline-secondary-bar.estimated {
  background: linear-gradient(90deg, #38bdf8, #3b82f6);
}

.timeline-secondary-bar.actual {
  background: linear-gradient(90deg, #10b981, #22c55e);
}

.timeline-secondary-start-dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 3px solid rgba(15, 23, 42, 0.95);
  transform: translate(-50%, -50%);
  z-index: 3;
}

.team-entry-node {
  background: #22c55e;
}

.team-exit-node {
  background: #ef4444;
}

/* --- NOTES LIST --- */
.notes-list-container {
  margin-top: 2rem;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
}

.note-item {
  border-left: 4px solid var(--accent);
  transition: var(--transition);
  background: rgba(15, 23, 42, 0.42);
  border-radius: 14px;
  padding: 0.95rem 1rem;
}

.note-item:hover {
  transform: translateX(5px);
  background: rgba(255, 255, 255, 0.05);
}

/* --- LOGIN & ADMIN REFINEMENTS --- */
.login-box {
  animation: slideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.field-help {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.role-checkbox-list {
  display: grid;
  gap: 0.6rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.45);
}

.role-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.35rem 0.2rem;
  cursor: pointer;
}

.role-checkbox-item input {
  margin-top: 0.2rem;
}

.role-checkbox-item span {
  color: var(--text-primary);
  line-height: 1.35;
}

.role-checkbox-item small {
  color: var(--text-secondary);
}

.role-profiles-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

.glass-subpanel {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem;
}

.glass-subpanel h3 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.role-profiles-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.role-profile-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.45);
}

.role-profile-item p {
  margin-top: 0.35rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.role-profile-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
}

.role-profile-actions button {
  flex: 0 0 auto;
}

.templates-layout {
  grid-template-columns: minmax(300px, 360px) 1fr;
  align-items: stretch;
}

#templatesModal .modal-content {
  width: min(1100px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  gap: 1rem;
  overflow: hidden;
}

#templatesModal .glass-subpanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#templatesModal .templates-layout {
  min-height: 0;
  overflow: hidden;
}

#templatesModal .templates-layout > .glass-subpanel:first-child {
  gap: 0.5rem;
}

#templatesModal .templates-layout > .glass-subpanel:last-child {
  overflow: hidden;
}

#templatesModal .templates-layout > .glass-subpanel:last-child .role-profiles-list {
  overflow-y: auto;
  padding-right: 0.25rem;
}

#templatesModal .form-group {
  margin-bottom: 0.6rem;
}

#templatesModal .modal-actions {
  margin-top: 0.5rem;
  position: sticky;
  bottom: 0;
  padding-top: 0.75rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.88) 35%);
}

.template-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.template-item > div:first-child {
  min-width: 0;
}

.template-phase-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.template-phase-editor {
  display: grid;
  gap: 0.5rem;
  max-height: 48vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.template-phase-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  grid-template-areas:
    "position phase-id actions"
    "position phase-name actions";
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.45rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.45);
}

.template-phase-position {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  font-weight: 700;
  font-size: 0.85rem;
  grid-area: position;
  align-self: stretch;
}

.template-phase-actions {
  display: flex;
  gap: 0.35rem;
  grid-area: actions;
  align-items: center;
  align-self: center;
}

#templatesModal input.template-phase-id {
  grid-area: phase-id;
}

#templatesModal input.template-phase-name {
  grid-area: phase-name;
}

.template-phase-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-top: 0.5rem;
}

#templatesModal input.template-phase-id,
#templatesModal input.template-phase-name {
  min-width: 0;
}

#templatesModal input.template-phase-id {
  width: 100%;
}

#templatesModal input.template-phase-name {
  width: 100%;
}

#templatesModal .role-profile-item {
  padding: 0.75rem;
}

#templatesModal .role-profile-item p {
  margin-top: 0.2rem;
  font-size: 0.9rem;
}

#phaseModal .modal-content {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

#phaseModal .modal-actions {
  position: sticky;
  bottom: 0;
  padding-top: 0.75rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.92) 35%);
}

.section-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.project-team-grid,
.work-orders-grid {
  display: grid;
  gap: 1rem;
}

.team-member-card,
.work-order-card {
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.team-member-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.team-member-card-head h3 {
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.team-member-card-head p,
.work-order-card p {
  color: var(--text-secondary);
}

.team-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 0.6rem;
}

.compact-detail-card {
  overflow: hidden;
  max-height: 6.6rem;
  transition: max-height 0.35s ease, transform 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.compact-detail-card:hover,
.compact-detail-card:focus-within {
  max-height: 24rem;
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(30, 41, 59, 0.82);
  transform: translateY(-2px);
}

.compact-card-topline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-bottom: 0.45rem;
}

.compact-card-title {
  margin-bottom: 0.3rem;
  color: var(--text-primary);
}

.compact-card-preview {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.35;
}

.compact-expand-body {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.25s ease, max-height 0.35s ease, margin-top 0.35s ease;
}

.compact-detail-card:hover .compact-expand-body,
.compact-detail-card:focus-within .compact-expand-body,
.qc-card:hover .compact-expand-body,
.qc-card:focus-within .compact-expand-body {
  opacity: 1;
  max-height: 18rem;
  margin-top: 0.6rem;
}

.compact-card-body {
  color: var(--text-primary);
  white-space: pre-wrap;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .timeline-secondary-label {
    font-size: 0.62rem;
  }
}

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

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
  background: var(--node-bg);
  border-radius: 4px;
}

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